package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.CallRecords;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CallRecordsMapper extends MyMapper<CallRecords> {

    List<CallRecords> findEmployeeCallList(CallRecords callRecords);

    @Update("update t_call_records set voice_id = #{voiceId},update_time = NOW() where customer_mobile = #{called} and employee_mobile = #{calling} and virtual_mobile = #{virtualNumber} and voice_id is null order by id desc limit 1")
    int updateIsNullVoiceByCondition(@Param("calling") String calling, @Param("called") String called, @Param("virtualNumber") String virtualNumber, @Param("voiceId") Integer voiceId);

   CallRecords selectByMobile(@Param("customerMobile")String customerMobile , @Param("employeeMobile")String  employeeMobile);

    CallRecords selectByAllMobile(@Param("customerMobile")String customerMobile , @Param("employeeMobile")String  employeeMobile,@Param ("virtualMobile")String virtual);

    /**
     * 获取当天拨打次数
     * @param customerInfoId
     * @return
     */
    List<CallRecords> selectByNow(@Param("customerInfoId")Integer customerInfoId);

    List<CallRecords> selectByCustomerInfoId(@Param("customerInfoId")Integer customerInfoId);

}
